<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "gky_xuesheng_jingsai".
 *
 * @property integer $id
 * @property string $name
 * @property string $xibie
 * @property string $sex
 * @property string $birthday
 * @property string $xueli
 * @property string $xuewei
 * @property string $biye
 * @property string $zhuanye
 * @property string $zhicheng
 * @property string $zhicheng_time
 * @property string $zhengshu
 * @property string $zhengshu_time
 * @property string $saixiang_name
 * @property string $jiangxiang_dengji
 * @property string $chengyuan
 * @property string $jiangxiang_jibie
 * @property string $huojiang_time
 * @property string $banjiang_jigou
 * @property string $beizhu
 */
class GkyXueshengJingsai extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'gky_xuesheng_jingsai';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['birthday', 'biye', 'zhicheng_time', 'zhengshu_time', 'huojiang_time'], 'safe'],
            [['chengyuan'], 'string'],
            [['name', 'xibie', 'sex', 'xueli', 'xuewei', 'zhuanye', 'zhicheng', 'zhengshu', 'saixiang_name', 'jiangxiang_dengji', 'jiangxiang_jibie', 'banjiang_jigou', 'beizhu'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'xibie' => 'Xibie',
            'sex' => 'Sex',
            'birthday' => 'Birthday',
            'xueli' => 'Xueli',
            'xuewei' => 'Xuewei',
            'biye' => 'Biye',
            'zhuanye' => 'Zhuanye',
            'zhicheng' => 'Zhicheng',
            'zhicheng_time' => 'Zhicheng Time',
            'zhengshu' => 'Zhengshu',
            'zhengshu_time' => 'Zhengshu Time',
            'saixiang_name' => 'Saixiang Name',
            'jiangxiang_dengji' => 'Jiangxiang Dengji',
            'chengyuan' => 'Chengyuan',
            'jiangxiang_jibie' => 'Jiangxiang Jibie',
            'huojiang_time' => 'Huojiang Time',
            'banjiang_jigou' => 'Banjiang Jigou',
            'beizhu' => 'Beizhu',
        ];
    }
     public static function jingsai($pageNow, $pageSize){
       $list = GkyXueshengJingsai::find()
            ->addSelect(['id','saixiang_name','name','huojiang_time'])
            ->addOrderBy(['huojiang_time' => SORT_DESC])
            ->offset(($pageNow - 1) * $pageSize)
            ->limit($pageSize)
            ->all();
        return $list;
    }
}
